import React, { Component } from 'react'
import PropTypes from 'prop-types' //无需下载
export default class Test extends Component {
  // static propTypes = {} 简写
  // static defaultProps = {} 简写
  render() {
    return (
      <ul>
        {this.props.list.map((item, index) => {
          return <li key={index}>{item}</li>
        })}
      </ul>
    )
  }
}

// 校验props
Test.propTypes = {
  list: PropTypes.array.isRequired,
}

// props默认值
Test.defaultProps = {
  list: ['大傻子', '必须要写list属性', 'list属性是数组哦'],
}
